%%
%% This is file `fduthesis.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fduthesis.dtx  (with options: `class')
%% This is a generated file.
%% Copyright (C) 2015-2018 by Wenbo Sheng <wbsheng@fudan.edu.cn>.
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% This version of this license is in
%% http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{fduthesis}
 [2018/01/13, v0.9b, LaTeX class for the thesis template (PhD or master) at Fudan University]





\RequirePackage{kvoptions}
\RequirePackage{etoolbox}
\RequirePackage{xstring}
\RequirePackage{ifxetex}
\RequirePackage{ifpdf}
\RequirePackage{xparse}
\RequirePackage{environ}
\SetupKeyvalOptions{family=FDU, prefix=FDU@, setkeys=\kvsetkeys}
\def\FDU@setopt{\kvsetkeys{FDU}}
\def\@clsname{ctexrep}
\def\@topheading{chapter}
\DeclareStringOption[noinput]{fontset}
\DeclareStringOption[phd]{degree}
\DeclareVoidOption{phd}{\FDU@setopt{degree=phd}}
\DeclareVoidOption{master}{\FDU@setopt{degree=master}}
\DeclareStringOption[final]{type}
\DeclareVoidOption{final}{\FDU@setopt{type=final}}
\DeclareVoidOption{draft}{\FDU@setopt{type=draft}}
\DeclareVoidOption{print}{\FDU@setopt{type=print}}
\DeclareVoidOption{anony}{\FDU@setopt{type=anony}}
\DeclareBoolOption[true]{openright}
\DeclareComplementaryOption{openany}{openright}
\DeclareBoolOption[true]{twoside}
\DeclareComplementaryOption{oneside}{twoside}
\DeclareBoolOption{fullwidthstop}
\DeclareBoolOption{lineno}
\DeclareBoolOption[true]{tuenc}
\DeclareComplementaryOption{euenc}{tuenc}
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{\@clsname}}
\ProcessKeyvalOptions{FDU}\relax
\newif\ifFDU@Degree@doctor
\newif\ifFDU@Degree@master
\IfStrEqCase{\FDU@degree}{%
{phd}{\FDU@Degree@doctortrue\FDU@Degree@masterfalse}%
{master}{\FDU@Degree@mastertrue\FDU@Degree@doctorfalse}%
}
\newif\ifFDU@Type@draft
\newif\ifFDU@Type@final
\newif\ifFDU@Type@print
\newif\ifFDU@Type@anony
\IfStrEqCase{\FDU@type}{%
{final}{\FDU@Type@finaltrue}%
{draft}{\FDU@Type@drafttrue}%
{print}{\FDU@Type@printtrue}%
{anony}{\FDU@Type@anonytrue}%
}
\ifFDU@Degree@doctor
\def\FDU@onetwoside{twoside}
\def\FDU@openrightany{openright}
\else
\ifFDU@Degree@master
\def\FDU@onetwoside{oneside}
\def\FDU@openrightany{openany}
\fi
\fi
\ifFDU@twoside
\def\FDU@onetwoside{twoside}
\else
\def\FDU@onetwoside{oneside}
\fi
\ifFDU@openright
\def\FDU@openrightany{openright}
\else
\def\FDU@openrightany{openany}
\fi
\PassOptionsToClass{\FDU@openrightany}{\@clsname}
\PassOptionsToClass{\FDU@onetwoside}{\@clsname}
\ifFDU@Type@draft
\PassOptionsToPackage{draft}{graphicx}
\typeout{Parse option 'draft' to package 'graphicx'.^^J}
\fi
\ifpdf\relax\else
\ifxetex\relax\else
\PassOptionsToPackage{dvipdfmx}{graphicx}
\typeout{Parse option 'dvipdfmx' to package 'graphicx'.^^J}
\fi\fi
\ifxetex
\ifFDU@tuenc\PassOptionsToPackage{tuenc}{fontspec}
\else\PassOptionsToPackage{euenc}{fontspec}
\fi
\LoadClass[UTF8, zihao=-4, notitlepage, fontset=none]{\@clsname} %[2015/09/15]
\ifxetex\ifFDU@fullwidthstop
\defaultCJKfontfeatures{Mapping=fullwidth-stop} % xecjk after 2013-06-07
\typeout{Mapping fullwidth stop in xetex mode.^^J}
\fi\fi % end ifxetex
\ExplSyntaxOn
\str_if_eq_x:nnTF { \FDU@fontset } { noinput }
{
\tl_new:N \l__ctex_platforminfo_tl
\ctex_detected_platform:
\tl_set:Nx \l__ctex_platforminfo_tl \g__ctex_fontset_tl
\tl_gset:Nx \g__ctex_fontset_tl { none }
\def\FDU@fonts{\l__ctex_platforminfo_tl}
} {
\def\FDU@fonts{\FDU@fontset}
}
\ExplSyntaxOff
\ctexset{fontset=\FDU@fonts}

\RequirePackage{geometry}
\ifxetex\else
\RequirePackage{microtype}
\fi
\RequirePackage{fancyhdr}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{mathtools}
\RequirePackage[amsmath,thmmarks]{ntheorem}
\typeout{Parse options 'amsmath' and 'thmmarks' to package 'ntheorem'.^^J}
\AtEndPreamble{\RequirePackage{bm}}
\RequirePackage{array}
\RequirePackage{tabularx}
\RequirePackage{booktabs}
\RequirePackage{calc}
\RequirePackage{caption}
\ifpdf
\RequirePackage{epstopdf}
\else
\ifxetex\relax\else
\RequirePackage{bmpsize}
\fi\fi
\geometry{a4paper,hmargin={1in,1in},vmargin={1.25in,1.25in},headheight=15pt}
\ifFDU@lineno
\RequirePackage[mathlines]{lineno}
\newcommand*\patchAmsMathEnvironmentForLineno[1]{%
\expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname
\renewenvironment{#1}%
{\linenomath\csname old#1\endcsname}%
{\csname oldend#1\endcsname\endlinenomath}}%
\newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{%
\patchAmsMathEnvironmentForLineno{#1}%
\patchAmsMathEnvironmentForLineno{#1*}}%
\AtBeginDocument{%
\patchBothAmsMathEnvironmentsForLineno{equation}%
\patchBothAmsMathEnvironmentsForLineno{align}%
\patchBothAmsMathEnvironmentsForLineno{flalign}%
\patchBothAmsMathEnvironmentsForLineno{alignat}%
\patchBothAmsMathEnvironmentsForLineno{gather}%
\patchBothAmsMathEnvironmentsForLineno{multline}%
}
\linenumbers
\fi
\gdef\@author{\@empty}
\gdef\@studentID{\@empty}
\gdef\@major{\@empty}
\gdef\@department{\@empty}
\gdef\@affiliation{\@empty}
\gdef\@supervisor@name{\@empty}
\gdef\@supervisor@title{\@empty}
\gdef\@submit@year{\@empty}
\gdef\@submit@month{\@empty}
\gdef\@submit@day{\@empty}
\gdef\@CLC{\@empty}
\newcommand{\studentID}[1]{\gdef\@studentID{#1}}
\newcommand{\major}[1]{\gdef\@major{#1}}
\newcommand{\department}[1]{\gdef\@department{#1}}
\newcommand{\affiliation}[1]{\gdef\@affiliation{#1}}
\newcommand{\supervisor}[2]{
\gdef\@supervisor@name{#1}\gdef\@supervisor@title{#2}}
\newcommand{\submitdate}[3]{
\gdef\@submit@year{#1}\gdef\@submit@month{#2}\gdef\@submit@day{#3}}
\newcommand{\CLC}[1]{\gdef\@CLC{#1}}
\ifFDU@Type@anony
\renewcommand{\author}[1]{\gdef\@author{\@empty}}
\renewcommand{\studentID}[1]{\gdef\@studentID{\@empty}}
\renewcommand{\major}[1]{\gdef\@major{\@empty}}
\renewcommand{\department}[1]{\gdef\@department{\@empty}}
\renewcommand{\supervisor}[2]{
\gdef\@supervisor@name{\@empty}
\gdef\@supervisor@title{\@empty}}
\renewcommand{\submitdate}[3]{
\gdef\@submit@year{\@empty}
\gdef\@submit@month{\@empty}
\gdef\@submit@day{\@empty}}
\fi

\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}\thispagestyle{empty}\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\setcounter{tocdepth}{1}
\let\oldtoc\tableofcontents
\renewcommand{\tableofcontents}{%
\clearpage\pagenumbering{roman}\oldtoc\pagestyle{plain}}
\newcounter{secnumdepthReserve}
\setcounter{secnumdepthReserve}{\arabic{secnumdepth}}
\newcommand{\setabstractname}[2]{%
\def\@cnabstractname{#1}\def\@enabstractname{#2}}
\setabstractname{摘\quad 要}{Abstract}
\newenvironment{cnabstract}{%
\setcounter{secnumdepth}{\m@ne}%
\chapter[中文摘要]{\@cnabstractname}%
}{%
\par\noindent\textbf{中图分类号：}\@CLC
\setcounter{secnumdepth}{\arabic{secnumdepthReserve}}
}
\newcommand{\cnkeyword}[1]{\par\noindent\textbf{关键词：}#1}
\newenvironment{enabstract}{%
\setcounter{secnumdepth}{\m@ne}%
\ctexset{chapter/break=\clearpage}
\chapter[英文摘要]{\@enabstractname}
}{%\pagestyle{empty}%
\par\noindent\textbf{Chinese Library Classification: }\@CLC
\setcounter{secnumdepth}{\arabic{secnumdepthReserve}}%
\ctexset{chapter/break=\if@openright\cleardoublepage\else\clearpage\fi}
}
\newcommand{\enkeyword}[1]{\par\noindent\textbf{Key words: }#1}
\newcommand{\mainmatter}{%
\clearpage
\pagestyle{fancy}
\fancyhf{}
\lhead{\small\kaishu\leftmark}
\rhead{\thepage}
\renewcommand{\headrulewidth}{0.8bp}
\pagenumbering{arabic}
}
\setcounter{secnumdepth}{3}
\ctexset{chapter/format+={\zihao{3}\bfseries},%
chapter/beforeskip={1.5cm plus 0.2cm minus 0.1cm},%
chapter/afterskip={1.2cm plus 0.2cm minus 0.1cm}}
\ctexset{section/name={\S~,~},
section/format+={\zihao{4}\bfseries},%
section/number={\arabic{chapter}.\arabic{section}},%
section/beforeskip={0.6cm plus 0.1cm minus 0.05cm},%
section/afterskip={0.4cm plus 0.1cm minus 0.05cm}}
\ctexset{subsection/format+={\zihao{-4}\bfseries},%
subsection/number={\arabic{chapter}.\arabic{section}.\arabic{subsection}},%
subsection/beforeskip={0.4cm plus 0.1cm minus 0.05cm},%
subsection/afterskip={0.4cm plus 0.1cm minus 0.05cm}}
\ctexset{subsubsection/format+={\zihao{-4}\bfseries},%
subsubsection/number={\arabic{chapter}.\arabic{section}.\arabic{subsection}.\arabic{subsubsection}},
subsubsection/beforeskip={0.3cm plus 0.1cm minus 0.05cm},
subsubsection/afterskip={0.3cm plus 0.1cm minus 0.05cm}
}
\ctexset{%
abstractname={摘要},%
contentsname={目\quad 录},%
listfigurename={插\quad 图},%
bibname={参考文献}}
\captionsetup{font=small,labelfont=bf,labelsep=quad,width=0.8\textwidth,skip=10pt,belowskip=10pt}
\captionsetup[table]{position=top}
\captionsetup[figure]{position=bottom}
\linespread{1.39}
\numberwithin{equation}{\@topheading}
\numberwithin{figure}{\@topheading}
\numberwithin{table}{\@topheading}
\NewEnviron{acknowledgement}{
\ifFDU@Type@anony\mbox{}\par\else
\chapter*{致谢}\thispagestyle{empty}\BODY\fi}
\RequirePackage[style=gb7714-2015]{biblatex}
\renewcommand{\bibfont}{\small}
\RequirePackage{pdfpages}
\AtBeginDocument{%
\RequirePackage{hyperref}
\hypersetup{pdfsubject={学位论文}}
\ifFDU@Type@print
\hypersetup{allcolors=red}
\else
\hypersetup{linkcolor=blue} % not necessary to set option `colorlinks=true'
\fi
\ifFDU@Type@draft\relax
\else
\hypersetup{pdfborder={0 0 0}}
\fi
\theorembodyfont{\normalfont\kaishu}
\theoremheaderfont{\normalfont\bfseries}
\theoremseparator{\hspace{1ex}}
\theorempreskip{3pt plus 1pt}
\theorempostskip{3pt plus 1pt}
\theoremindent0pt
\newtheorem{definition}{定义}[chapter]
\newtheorem{theorem}[definition]{定理}
\newtheorem{axiom}[definition]{公理}
\newtheorem{lemma}[definition]{引理}
\newtheorem{proposition}[definition]{命题}
\newtheorem{corollary}[definition]{推论}
\newtheorem{property}[definition]{性质}
\newtheorem{assumption}[definition]{假设}
\newtheorem{remark}{注}[chapter]
\newcommand{\qedsymb}{\ensuremath{\Box}}
{
\theoremstyle{nonumberplain}
\theoremheaderfont{\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{\hspace{1ex}}
\theoremsymbol{\qedsymb}
\theorempostskip{1ex plus 0.3ex}
\newtheorem{proof}{证明}
}
}% end of \AtBeginDocument

\endinput
%%
%% End of file `fduthesis.cls'.
